home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 July
/
EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso
/
earcd
/
util
/
rexx
/
yarselec.lha
/
YARSelector.doc
next >
Wrap
Text File
|
1997-02-25
|
6KB
|
173 lines
YARSelector
-----------
Disclaimer
----------
This script is a work of only three hours. It ist not tested very well
and it may not work under strange circumstances.
So use it ON YOUR OWN RISK, if you want, or let it be!
This script is freeware, so you can use it, change it, delete it, get
inspired from it or print it in poster size to wallpaper your room
with it.
What is it for?
---------------
I found some days ago a program called 'RNDPat' in AMINET. This
program random selects pictures from a given dir and generates a
WBPattern-Prefsfile to randomly show background pictures on WB.
But as any other program random selecting things, it selects some
pictures more often, than others and some are shown very rarely.
So I had the idea to add every shown picture to a list and the next
time, the program executes, it scans this list and excludes all shown
pictures from the next random choice. So it selects a picture only if
it was not shown before. Of course, if all pictures were shown, the
procedure should repeat.
I wrote this suggestion to the author but he answered, that he don't
want to write on disk during startup.
But I want! And so I wrote this tiny script.
So, if you also don't have these scruples, you may use this program,
see ALL of your beautiful pics and don't get bored anymore. :-}
Installation/Usuage
-------------------
The script is not very comfortable, but since you normally setup it
one time and never again (until you remove it), this should be no
problem.
At first you copy the script anywhere, you want - in the following
example it is located in REXX: .
Then you add a line to your user-startup:
REXXC:RX Rexx:YARSelector.rexx WBDIR <dir> WINDIR <dir> SCRDIR <dir>...
... PREFSFILE <file> REMAP <TRUE/FALSE>
All option keywords must be given, they have to be uppercase (!) and
they must have the same order as above.
Sorry, but there is NO ParseArg() function in any of these RexxLibs
flying around, even though it would be so easy to implement it.
Options: WBDIR - directory for the WB-Window background pictures
WINDIR - directory for the drawer windows
SCRDIR - directory for the WB-Screen
PREFSFILE - the prefs file to be created, normally this
should be 'ENV:Sys/WBPattern.prefs'
REMAP - if TRUE, the pictures get remapped before shown
to get the best possible colours - if set to
FALSE, the pictures should have the same
palette as WB, otherwise they may look very
strange - on the other hand this is faster
Because IPrefs notifies any change to the prefs files, you can run the
script as often as you want to get new BG-pics.
IPrefs automatically reads the new Prefs-File and displays the new
pictures.
BTW: If you remove all the lines between the two asterisk-comments you
can use the rest of the script as an empty REXX-script with a nice
error handling procedure and an ende()-Routine to end a script,
optionally opening a requester and/or quit with an given
Return-Code.
Example for ende(): call ende("Hello world",5)
Internas
--------
Here are the most important facts about the WBPattern-Prefs file to
understand, how the script works. Not all bytes of the prefs file are
explained, because I also have no complete description of it's contens
and I only spend my time to find out the parts relating to my program:
The first bytes:
> 464f524d 00000132 50524546 50524844 00000006 00000000 0000
F O R M ^Length^ P R E F P R H D ^Length^
| |
(FORM-Chunk) (PRHD-Chunk)
Starting with position 27 (dec.), (normally) three PTRN-Chunks are
saved, which describe the options for the background pictures for
Workbench, Screen and Windows:
> 5054 524e0000 00580000 00000000 00000000 00000000 00000000
P T R N ^^Length^ 1)
|
(PTRN-Chunk)
1) 00 - Workbench 01 - Window 02 - Screen
> 00110002 003Exxxx xxxxxxxx ...
2) ^3)^
2) 00 - Picture/REMAP 01 - Pattern/REMAP
10 - Picture/NOREMAP 11 - Pattern/NOREMAP
3) Length Filename/Pattern
After 3) appears the name of the picture to be shown or the
description for the pattern. The pattern is saved with two bytes per
line and 16 bytes vertically. The first 32 bytes represent the first
bitmap, the next 32 bytes store the second bitmap and so on.
If the chunk stores a filename with an odd number of characters, at
3) the correct length is saved, but since all IFF-Chunks must have an
even number of bytes (complete words), a zero-byte is added after the
filename.
At this point the next PTRN-Chunk is saved and so on.
Bugs/History/Future
-------------------
WHAT?!
Ok, ok - let's say, if you found a bug or the script doesn't work, you
can email me and I try to help you to get the script working.
But if you want huge improvements or numerous updates - please write
them yourself - for my needs the script is complete and it works fine
on my computer.
Author
------
Of course it would be nice to hear from you, if you use this script...
...Yes, I know, what you think:
Har, har, very funny! Publishing a program - everything works
without paying a penny (idiot) - and then begging for email...pffft!
Uuuuh! This is really too much indeed, isn't it? :-}
Anyway - do what you want. :-P
My email address: a.boerner@bbrandes.berlinet.de (Andreas Boerner)
Have fun!